package vip.lsjscl.flowboot.util.constants;

import lombok.Getter;

/**
 * 活动状态枚举
 * 待办理 10, 已办理 20
 *
 * @author zhangxingju
 * @date 2025/02/14
 */
@Getter
public enum ActivityStatus {
    NOT_ACTIVATED(0),//未激活
    PENDING(10),//待办理
    COMPLETED(20),//已办理
    TERMINATED(30),//流程终止
    RETURNED(40),//已退回
    BACK_PREVIOUS(50);//已退回

    private final Integer code;

    ActivityStatus(Integer code) {
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public static ActivityStatus fromCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (ActivityStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("无效的状态码: " + code);
    }
}